home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / comm2 / amislt14.lha / AmiSlate / SlateRexx / qix.rexx < prev    next >
OS/2 REXX Batch file  |  1996-01-27  |  2KB  |  110 lines

  1. /* An Arexx script for use with AmiSlate:  
  2.  
  3.    Does the cool Qix/bouncing line/screenblanker thingy  :)
  4.    
  5. */
  6. parse arg CommandPort ActiveString
  7.  
  8. address (CommandPort)
  9.  
  10. if (length(CommandPort) == 0) then do
  11.     say ""
  12.     say "Usage:  rx qix.rexx <REXXPORTNAME>"
  13.     say "        (REXXPORTNAME is usually AMISLATE)"
  14.     say ""
  15.     say "Or run from the Rexx menu within AmiSlate."
  16.     say ""
  17.     exit 0
  18.     end
  19.  
  20. /* Necessary for "delay" to work */ 
  21. check = addlib('rexxsupport.library', 0, -30, 0)
  22.  
  23.  
  24. options results
  25.  
  26. x=15
  27. y=15
  28. dx=0
  29. dy=0
  30. nsteps = 1000
  31. nscale = 16/1000
  32.  
  33. /* Draw a black box around the window border */
  34. setfcolor 0 0 0
  35. GetWindowAttrs stem win.
  36.  
  37.  
  38. /* Note that GetWindowAttrs returns the size of the whole window including
  39.    the ToolBar, Palette, Chat Lines, Title, and everything else.  To just
  40.    draw to the border of the drawing area, we need to subtract the constants
  41.    below.  */
  42.  
  43. square 0 0 (win.width - 58) (win.height - 53)
  44.  
  45.  
  46. MinX = 1
  47. MinY = 1
  48. MaxX = win.width - 59
  49. MaxY = win.height - 54
  50.  
  51. speed = 10
  52. x1 = Rand(MaxX-MinX)+MinX 
  53. y1 = Rand(MaxY-MinY)+MinX
  54. x2 = Rand(MaxX-MinX)+MinX 
  55. y2 = Rand(MaxY-MinY)+MinX
  56.  
  57. x1d = Rand(speed*2) - trunc(speed/2)
  58. y1d = Rand(speed*2) - trunc(speed/2)
  59. x2d = Rand(speed*2) - trunc(speed/2)
  60. y2d = Rand(speed*2) - trunc(speed/2)
  61.  
  62. do while (1)
  63.     line x1 y1 x2 y2 XOR
  64.     xx = delay(1) 
  65.     line x1 y1 x2 y2 XOR
  66.  
  67.     x1 = x1 + x1d
  68.     x2 = x2 + x2d
  69.     y1 = y1 + y1d
  70.     y2 = y2 + y2d
  71.     
  72.     if (x1 > MaxX) then do
  73.         x1 = MaxX
  74.         x1d = -Rand(speed)
  75.         end
  76.     if (x2 > MaxX) then do
  77.         x2 = MaxX
  78.         x2d = -Rand(speed)
  79.         end
  80.  
  81.     if (x1 < MinX) then do
  82.         x1 = MinX
  83.         x1d = Rand(speed)
  84.         end
  85.     if (x2 < MinX) then do
  86.         x2 = MinX
  87.         x2d = Rand(speed)
  88.         end
  89.  
  90.     if (y1 > MaxY) then do
  91.         y1 = MaxY
  92.         y1d = -Rand(speed)
  93.         end
  94.     if (y2 > MaxY) then do
  95.         y2 = MaxY
  96.         y2d = -Rand(speed)
  97.         end
  98.  
  99.     if (y1 < MinY) then do
  100.         y1 = MinY
  101.         y1d = Rand(speed)
  102.         end
  103.     if (y2 < MinY) then do
  104.         y2 = MinY
  105.         y2d = Rand(speed)
  106.         end
  107. end
  108.  
  109. rand:
  110.     return trunc(Random()*arg(1)/1000)+1